package abs.web.jsf;

import abs.dao.MonedasDAO;

import abs.domain.Monedas;

import abs.service.MonedasService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.context.annotation.Scope;

import org.springframework.stereotype.Component;

import org.springframework.transaction.annotation.Transactional;

/**
 * Spring Component that handles CRUD requests for Monedas entities
 * 
 */
@Scope("session")
@Component("MonedasComponent")
public class MonedasComponentImpl implements MonedasComponent {

	/**
	 * Data type variable that provides CRUD operations for Monedas entities
	 * 
	 */
	private Monedas monedas;

	/**
	 * DAO injected by Spring that manages Monedas entities
	 * 
	 */
	@Autowired
	private MonedasDAO monedasDAO;

	/**
	 * Service injected by Spring that provides CRUD operations for Monedas entities
	 * 
	 */
	@Autowired
	private MonedasService monedasService;

	/** 
	 */
	public MonedasComponentImpl() {
	}

	/**
	 * Save an existing Monedas entity
	 * 
	 */
	@Override
	@Transactional
	public String saveMonedas(Monedas monedas) {
		monedasService.saveMonedas(monedas);
		return "/jsf/monedas/listMonedass.xhtml";
	}

	/**
	 * Edit an existing Monedas entity
	 * 
	 */
	@Override
	@Transactional
	public String editMonedas(String co010clcaKey) {
		monedas = monedasDAO.findMonedasByPrimaryKey(co010clcaKey);

		return "/jsf/monedas/editMonedas.xhtml";
	}

	/**
	 * Select an existing Monedas entity
	 * 
	 */
	@Override
	@Transactional
	public String selectMonedas(String co010clcaKey) {
		monedas = monedasDAO.findMonedasByPrimaryKey(co010clcaKey);

		return "/jsf/monedas/viewMonedas.xhtml";
	}

	/**
	 * Getter for variable Monedas
	 * 
	 */
	@Override
	@Transactional
	public Monedas getMonedas() {
		return monedas;
	}

	/**
	 * Show all Monedas entities
	 * 
	 */
	@Override
	@Transactional
	public List<Monedas> listMonedass() {
		return new java.util.ArrayList<Monedas>(monedasService.loadMonedass());
	}

	/**
	 * Create a new Monedas entity
	 * 
	 */
	@Override
	@Transactional
	public String newMonedas() {
		monedas = new Monedas();

		return "/jsf/monedas/createMonedas.xhtml";
	}

	/**
	 * Select the Monedas entity for display allowing the user to confirm that they would like to delete the entity
	 * 
	 */
	@Override
	@Transactional
	public String confirmDeleteMonedas(String co010clcaKey) {
		monedas = monedasDAO.findMonedasByPrimaryKey(co010clcaKey);

		return "/jsf/monedas/deleteMonedas.xhtml";
	}

	/**
	 * Delete an existing Monedas entity
	 * 
	 */
	@Override
	@Transactional
	public String deleteMonedas(String co010clcaKey) {
		Monedas monedas = monedasDAO.findMonedasByPrimaryKey(co010clcaKey);
		monedasService.deleteMonedas(monedas);
		return "/jsf/monedas/listMonedass.xhtml";
	}

}
